package com.bjpowernode.other.atomic;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicInteger01 {
    public static void main(String[] args) {
        AtomicInteger ai = new AtomicInteger(0);//int ai = 0

        System.out.println(ai.incrementAndGet());//++ai
        System.out.println(ai.getAndIncrement());//ai++
        System.out.println(ai.getAndDecrement());
        System.out.println(ai.updateAndGet(i -> i + 10));//ai = ai + 10;
    }
}
